/*
 *   Copyright (C) 2007 by Andrzej Oczkowicz
 *   andrew_lz@poczta.fm
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 *   KMediaCatalog :)
 *
 */

#include "kmodule.h"
#include "dbg.h"

kModule::kModule(int version, const QString & name, const QString & author, const QString & description)
  :kVersion(version, name, description, author)
{
}

kModule::~kModule()
{
  for (int i=0; i < _plugins.size(); i++)
    if ( _plugins.at(i) ){
      _D << QString("deleting %1::%2").arg( name() ).arg( _plugins.at(i)->name() ).toAscii();
      delete _plugins.at(i);
    }
  _plugins.clear();
}

kPluginList * kModule::plugins()
{
  return &_plugins;
}

int kModule::addPlugin(kPlugin * p)
{
  _plugins.append(p);
  return count();
}

int kModule::count()
{
  return _plugins.size();
}

int kModule::delPlugin(int idx)
{
  _plugins.removeAt(idx);
  return count();
}

kPlugin * kModule::plugin(int idx)
{
  return _plugins.at(idx);
}

kInputPlugin::~ kInputPlugin()
{
  _D << "dest";
}

bool kInputPlugin::canYouHandle(kFileInfo * fi)
{
  _D << "";
  return false;
}


int kInputBasic::getFileInfo(kFileInfo * f, kInfoResult & result)
{
  return 0;
}

int kInputBasic::getType()
{
  return 0;
}

kPlugin::kPlugin(int version, const QString & name, const QString & description)
  :kVersion(version, name, description)
{
}

kInputPlugin::kInputPlugin(int version, const QString & name, const QString & description)
:kPlugin(version, name, description)
{
}

kInputBasic::kInputBasic(int version, const QString & name, const QString & description)
:kInputPlugin(version, name, description)
{
}

kInputArchive::kInputArchive(int version, const QString & name, const QString & description)
:kInputPlugin(version, name, description)
{
}

kOutputPlugin::kOutputPlugin(int version, const QString & name, const QString & description)
:kPlugin(version, name, description)
{
}

kOutputBasic::kOutputBasic(int version, const QString & name, const QString & description)
:kOutputPlugin(version, name, description)
{
}




